package cn.fay.chapter18;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;

public class BinaryFile {
	public static byte[] read(File bFile){
		try {
			BufferedInputStream bf=new BufferedInputStream(new FileInputStream(bFile));
			try{
				byte[] data=new byte[bf.available()];
				bf.read(data);
				return data;
			}finally{
				bf.close();
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
	
	public static byte[] read(String fileName){
		return read(new File(fileName).getAbsoluteFile());
	}
}
